<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>demo</title>
  <script type="text/javascript" src="./vue.js"></script>
</head>
<style>
  .login {
    background-color: aqua;
  }

  .rejest {
    background-color: rgb(255, 0, 21);
  }
</style>

<body>
  <div id="app">
    <h1>{{isLogin?'登录':'注册'}}</h1>
    <button @click="isLogin=true">登录</button>
    <button @click="isLogin=false">注册</button>

    <template>
      <form action="###" v-if="isLogin" class="login" key="login">
        username <input type="text" name="name">
        password <input type="password" name="psw">
      </form>
      <form action="###" v-else="isLogin" class="rejest" key="rejest">
        username <input type="text" name="name">
        password <input type="password" name="psw">
      </form>
    </template>





  </div>
</body>
<script type="text/javascript">
  Vue.config.productionTip = false;
  const vm = new Vue({
    el: "#app",
    data() {
      return {
        isLogin: true
      }
    }
  })
</script>

</html>